# coding=utf-8
import os.path

import numpy as np
import util
import matplotlib.pyplot as plt
import pylab
import cv2
import cv2 as cv
import timeit
import sys
import time
from typing import Tuple
from util import global_variable
import watershed
import json
from util import json_with_multiple_roi_to_single
from util import get_roi_from_single_roi_json_file_write_2_roi_dir

start = time.process_time()

#  multi_json_file_dir =  "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/jingKuang_json"
#
#  util.exec_fun_for_files_in_dir(multi_json_file_dir,json_with_multiple_roi_to_single)
#
#  multi_json_file_dir =  "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/weiKuang_json/"
#  util.exec_fun_for_files_in_dir(multi_json_file_dir,json_with_multiple_roi_to_single)




#  e824_single_json_file_name = "/home/hhd/workspace/longi_coal_picture/jingKuang_json/json_file_with_single_roi/824_00260_18_016_0.json"
#  jing_kuang_single_json_dir = "/home/hhd/workspace/longi_coal_picture/jingKuang_json/json_file_with_single_roi/"
#  zhongKuang1_single_json_dir = "/home/hhd/workspace/longi_coal_picture/zhongKuang1_json/json_file_with_single_roi/"
#  zhongKuang2_single_json_dir = "/home/hhd/workspace/longi_coal_picture/zhongKuang2_json/json_file_with_single_roi/"
#  weiKuang_single_json_dir = "/home/hhd/workspace/longi_coal_picture/weiKuang_json/json_file_with_single_roi/"

jing_kuang_single_json_dir = "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/jingKuang_json/json_file_with_single_roi/"
weiKuang_single_json_dir = "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/weiKuang_json/json_file_with_single_roi/"


util.longi_coal_picture_dir = "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/"


util.roi_dir =  "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/jingKuang_roi/"
util.createDirIfNotExist(util.roi_dir)
util.exec_fun_for_files_in_dir(jing_kuang_single_json_dir,get_roi_from_single_roi_json_file_write_2_roi_dir)


util.roi_dir =  "/home/hhd/workspace/longi_coal_picture/tie_xin/tie_xin_u16_c3/weiKuang_roi/"
util.createDirIfNotExist(util.roi_dir)
util.exec_fun_for_files_in_dir(weiKuang_single_json_dir,get_roi_from_single_roi_json_file_write_2_roi_dir)


#  util.roi_dir =  "/home/hhd/workspace/longi_coal_picture/roi_dirs/zhongKuang2_roi/"
#  util.createDirIfNotExist(util.roi_dir)
#  util.exec_fun_for_files_in_dir(zhongKuang2_single_json_dir,get_roi_from_single_roi_json_file_write_2_roi_dir)
#
#  util.roi_dir =  "/home/hhd/workspace/longi_coal_picture/roi_dirs/weiKuang_roi/"
#  util.createDirIfNotExist(util.roi_dir)
#  util.exec_fun_for_files_in_dir(weiKuang_single_json_dir,get_roi_from_single_roi_json_file_write_2_roi_dir)



end = time.process_time()
print("程序运行时间: ", end - start, " seconds")
